package net.bezrabotnih.server.domain;

import java.util.List;

import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.validation.constraints.NotNull;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import org.springframework.transaction.annotation.Transactional;

@RooJavaBean
@RooToString
@RooEntity(identifierType = String.class,identifierField="id")
public class JobType {

	
	@NotNull
	private String name;
	
	private String about;
    
	@Transactional
	public static List<JobType> findJobTypes(List<String> ids){
		 if (ids == null || ids.size() == 0) return null;
	        try {
	            return (List<JobType>) entityManager().createQuery("SELECT o FROM JobType o WHERE o.id MEMBER OF :ids").setParameter("ids", ids).getResultList();
	        } catch (org.springframework.dao.EmptyResultDataAccessException e) {
	            return null;
	        } catch (javax.persistence.NoResultException e) {
	            return null;
	        }
	}
	
}
